<?php

namespace App\Http\Requests\Admin\Customer\Banner;

use App\Http\Requests\ApiRequest;

/**
 * @property int store_id
 * @property int device_account_id
 * @property int banner_type_id
 * @property string name
 * @property array order_bys
 */
class BannerIndexRequest extends ApiRequest
{
    /**
     * Determine if the user is authorized to make this request.
     *
     * @return bool
     */
    public function authorize()
    {
        return true;
    }

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules()
    {
        $data = [
            'store_id'             => 'nullable|numeric|min:1',
            'device_account_id'    => 'nullable|numeric|min:1',
            'banner_type_id'       => 'nullable|numeric|min:1',
            'name'                 => 'nullable|string',
            'order_bys'            => 'nullable|array',
            'order_bys.*.order_by' => 'required|string',
            'order_bys.*.sort'     => 'required|string|in:desc,asc',
        ];

        return $data;
    }
}
